package com.tjsinfo.tjsoa.vote.action;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionForward;
import org.apache.struts.action.ActionMapping;

import com.tjsinfo.tjsoa.vote.bo.ITVoteEstimatedBO;

public class EstimatedDelAction extends Action {
	private ITVoteEstimatedBO estimatedBo;

	public void setEstimatedBo(ITVoteEstimatedBO estimatedBo) {
		this.estimatedBo = estimatedBo;
	}
	public ActionForward execute(ActionMapping mapping, ActionForm form,
			HttpServletRequest request, HttpServletResponse response) {
		try {
			String headId = request.getParameter("headId");
			String status = request.getParameter("status");
			String estimatedId = request.getParameter("estimatedId");
			
			estimatedBo.delete(estimatedId);
			
			request.setAttribute("linkurl", "tjsinfo/tjsoa/vote/estimatedList.do?headId="+headId+"@status="+status);
			request.setAttribute("message", "vote.estimateDel.message");
			
			return mapping.findForward("success");
		} catch (Exception e) {
			e.printStackTrace();
			return mapping.findForward("error");
		}
	}
}
